//
//  HNHomeTabBarView.m
//  HappyNews
//
//  Created by baiping on 16/1/14.
//  Copyright © 2016年 BPWBANP. All rights reserved.
//

#import "HNHomeTabBarView.h"

@implementation HNHomeTabBarView

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        [self addSubviews];
        
    }
    
    return self;
    
}

- (void)addSubviews{
    
    _backBtn = [[UIButton alloc]init];
    
    _nextBtn = [[UIButton alloc]init];
    
   // _nextBtn.backgroundColor = [UIColor redColor];
    
    _thumbBtn = [[UIButton alloc]init];
    
    _shareBtn = [[UIButton alloc]init];
    
   // _shareBtn.backgroundColor = [UIColor redColor];
    
    _messageBtn = [[UIButton alloc]init];
    
    _thumbNumberLabel = [[UILabel alloc]init];
    
    _messageNumberLabel = [[UILabel alloc]init];

    _thumbNumberLabel.font = [UIFont systemFontOfSize:7];
    
    _messageNumberLabel.font = [UIFont systemFontOfSize:8];
    
    _messageNumberLabel.textColor = [UIColor whiteColor];
    
    _messageNumberLabel.textAlignment = NSTextAlignmentCenter;
    
    // 添加一点击赞 上面就弹出一个+1的动画效果
    
    _addNumberLabel = [[UILabel alloc]init];
    
    _addNumberLabel.font = [UIFont systemFontOfSize:15];
    
    _addNumberLabel.textColor = HNBgColor;
    
    _addNumberLabel.textAlignment = NSTextAlignmentCenter;
    
    _addNumberLabel.text = @"+1";
    
    _addNumberLabel.alpha = 0;
    
    [self addSubview:_backBtn];

    [self addSubview:_nextBtn];
    
    [self addSubview:_thumbBtn];
    
    [self addSubview:_shareBtn];
    
    [self addSubview:_messageBtn];
    
    [self addSubview:_thumbNumberLabel];
    
    [self addSubview:_messageNumberLabel];
    
    [self addSubview:_addNumberLabel];
    
    [_backBtn setImage:[UIImage imageNamed:@"News_Navigation_Arrow"] forState:(UIControlStateNormal)];
    
    [_nextBtn setImage:[UIImage imageNamed:@"News_Navigation_Next"] forState:(UIControlStateNormal)];
    
    [_thumbBtn setImage:[UIImage imageNamed:@"News_Navigation_Vote"] forState:(UIControlStateNormal)];
    
    [_shareBtn setImage:[UIImage imageNamed:@"News_Navigation_Share"] forState:(UIControlStateNormal)];
    
    
    [_messageBtn setImage:[UIImage imageNamed:@"News_Navigation_Comment"] forState:(UIControlStateNormal)];
    
    
    [_thumbBtn setBackgroundImage:[UIImage imageNamed:@"News_Navigation_Voted"] forState:(UIControlStateSelected)];
    
    
    
}

- (void)layoutSubviews{
    
    CGFloat buttonW = 50;
    
    CGFloat buttonH = 64;
    
    CGFloat buttonMargin = (kScreenWidth - buttonW * 5 - 10 * 2) / 4;
    
    _backBtn.frame = CGRectMake(0, 0, buttonW, buttonH);
    
    _nextBtn.frame = CGRectMake(_backBtn.right + buttonMargin, _backBtn.top, buttonW, buttonH);
    
    _thumbBtn.frame = CGRectMake(_nextBtn.right + buttonMargin, _backBtn.top, buttonW, buttonH);
    
    _thumbNumberLabel.frame = CGRectMake(_thumbBtn.right - 20 , _thumbBtn.top + 20, 20, 10);
    
    
    _shareBtn.frame = CGRectMake(_thumbBtn.right + buttonMargin, _backBtn.top, buttonW, buttonH);
    
    
    _messageBtn.frame = CGRectMake(_shareBtn.right + buttonMargin, _backBtn.top, buttonW, buttonH);
    
    _messageNumberLabel.frame = CGRectMake(_messageBtn.right - 20 , _messageBtn.top + 18, 10, 10);
    
    
    _addNumberLabel.frame = CGRectMake(_thumbBtn.left + 25, _thumbBtn.top - 10, 30, 30);
    
    
    
    
}


@end
